home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Applications 1996 May
/
SGI IRIX 6.2 Applications 1996 May.iso
/
dist
/
impr_dev.idb
/
usr
/
impressario
/
src
/
libimp
/
impRowMisc.c.z
/
impRowMisc.c
Wrap
C/C++ Source or Header
|
1996-05-06
|
3KB
|
112 lines
/**************************************************************************
*
* Copyright (c) 1993 Silicon Graphics, Inc.
* All Rights Reserved
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by Silicon
* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is
* the property of Silicon Graphics, Inc. Any use, duplication or
* disclosure not specifically authorized by Silicon Graphics is strictly
* prohibited.
*
* RESTRICTED RIGHTS LEGEND:
*
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in
* Technical Data and Computer Software clause at DFARS 52.227-7013,
* and/or in similar or successor clauses in the FAR, DOD or NASA FAR
* Supplement. Unpublished - rights reserved under the Copyright Laws of
* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.
* Shoreline Blvd., Mountain View, CA 94039-7311
**************************************************************************
*
* File: impRowMisc.c
*
* Description: Perform miscellaneous operations on image rows.
*
**************************************************************************/
#ident "$Revision: 1.1 $"
#include <stdio.h>
#include <sys/types.h>
#include <assert.h>
#include "impI.h"
/**************************************************************************
*
* Function: impPackRow
*
* Description: Copies the specified row of short values into the
* byte sized destination. Note that the source values are not
* scaled to the byte range.
*
* Parameters:
* dptr (O) - destination row
* sptr (I) - source row
* n (I) - number of pixels in row
*
* Return: none
*
**************************************************************************/
void impPackRow(register uchar_t *dptr, register short *sptr, int n)
{
/*
* Sanity check the inputs
*/
assert(dptr != NULL);
assert(sptr != NULL);
/*
* We start from the begiining and move up. This way if
* dptr and sptr point to the same storage, the copy
* will still work
*/
while (n--)
*dptr++ = *sptr++ & 0xFF;
}
/**************************************************************************
*
* Function: impUnpackRow
*
* Description: Copies the specified row of short values into the
* byte sized destination. Note that the source values are not
* scaled to the short range.
*
* Parameters:
* dptr (O) - destination row
* sptr (I) - source row
* n (I) - number of pixels in row
*
* Return: none
*
**************************************************************************/
void impUnpackRow(register short *dptr, register uchar_t *sptr, int n)
{
/*
* Sanity check the inputs
*/
assert(dptr != NULL);
assert(sptr != NULL);
/*
* We start from the end and go backwards. This way if
* dptr and sptr point to the same storage the copy will
* still work.
*/
dptr += (n - 1);
sptr += (n - 1);
while (n--)
*dptr-- = *sptr--;
}